package com.ledou44.ledousrad;

import com.ledou44.ledousrad.service.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

@Component
public class LedouSradStart implements ApplicationListener<ContextRefreshedEvent> {

    @Autowired
    private Service service;

    /**
     * spring容器将所有的Bean都初始化完成之后就会执行该方法
     * @param event 事件
     */
    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        service.run();
    }
}
